home *** CD-ROM | disk | FTP | other *** search
/ Explorers of the New World / Explorers of the New World.iso / pc / exhelp.dir / 00031_MODE Handlers.ls < prev    next >
Encoding:
Text File  |  1995-09-06  |  2.5 KB  |  105 lines

  1. on setMode
  2.   global mode, searchSuccessFul
  3.   if (mode = "index") or not searchSuccessFul then
  4.     setIndexMode()
  5.   else
  6.     if mode = "search" then
  7.       setSearchMode()
  8.     end if
  9.   end if
  10. end
  11.  
  12. on setIndexMode
  13.   global browserTopLine, indexButton, searchButton, browserTopics, numVisibleTopics, findButton, mode, masterBrowserTopics
  14.   set mode to "index"
  15.   if isEnabled(indexButton) then
  16.     enableButton(searchButton)
  17.     activateButtonKeepActivated(indexButton)
  18.     disableUserTyping()
  19.     clearSearchTopicField()
  20.     disableTopicButtons()
  21.     disableButton(findButton)
  22.     updateStage()
  23.     set browserTopLine to 1
  24.     set browserTopics to the text of cast "browserTopics"
  25.     set masterBrowserTopics to browserTopics
  26.     setFieldText("browser", browserTopLine, numVisibleTopics, browserTopics)
  27.     setSearchSuccessFul(0)
  28.     clearDatabase()
  29.   end if
  30. end
  31.  
  32. on setSearchMode
  33.   global indexButton, searchButton, inputField, findButton, mode
  34.   set mode to "search"
  35.   if isEnabled(searchButton) then
  36.     enableButton(indexButton)
  37.     activateButtonKeepActivated(searchButton)
  38.     enableButton(findButton)
  39.     disableTopicButtons()
  40.     clearDatabase()
  41.     enableUserTyping()
  42.     setClearedFlag(0)
  43.   end if
  44. end
  45.  
  46. on disableUserTyping
  47.   global inputField
  48.   set the editableText of sprite inputField to 0
  49.   set the keyDownScript to "displayKeyLineAtTop"
  50.   set the keyUpScript to EMPTY
  51. end
  52.  
  53. on enableUserTyping
  54.   global inputField
  55.   set the keyDownScript to EMPTY
  56.   set the keyUpScript to "checkReturnKey"
  57.   set the editableText of sprite inputField to 1
  58. end
  59.  
  60. on checkReturnKey
  61.   if the key = RETURN then
  62.     hilite char 1 to 32000 of field "searchTopic"
  63.     doFind(the text of cast "searchTopic")
  64.   end if
  65. end
  66.  
  67. on clearDatabase
  68.   global textSprite, clearedFlag, printButton
  69.   if not clearedFlag then
  70.     set the castNum of sprite textSprite to the number of cast "Empty Text"
  71.     clearTitle()
  72.     unhiliteClickedTopic()
  73.     removeMoreButtons()
  74.     disableButton(printButton)
  75.     setButtonCursor(0, printButton)
  76.     updateStage()
  77.     setClearedFlag(1)
  78.   end if
  79. end
  80.  
  81. on setClearedFlag val
  82.   global clearedFlag
  83.   set clearedFlag to val
  84. end
  85.  
  86. on enableTopicButtons
  87.   global pictureButton, textButton, mapButton, printButton
  88.   enableButton(pictureButton)
  89.   enableButton(textButton)
  90.   enableButton(mapButton)
  91.   enableButton(printButton)
  92. end
  93.  
  94. on disableTopicButtons
  95.   global pictureButton, textButton, mapButton, printButton
  96.   disableButton(pictureButton)
  97.   disableButton(textButton)
  98.   disableButton(mapButton)
  99.   disableButton(printButton)
  100. end
  101.  
  102. on clearSearchTopicField
  103.   put EMPTY into field "searchTopic"
  104. end
  105.